/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package testsql;


import java.sql.*;

/**
 *
 * @author lamagat
 */
public class TESTSQL {
    public TESTSQL()
    {
        String url = "jdbc:mysql://localhost/Compteur"; //Compteur nom de la BDD
        Connection con;
        String query = "SELECT * from typeinstalaation"; // une requete SQL
        Statement stmt;
        try {
            Driver mySQLDriver = new org.gjt.mm.mysql.Driver();
            con = DriverManager.getConnection(url, "root", ""); //o est le login du user et ol le mot de passe
            System.out.println("Con = " +con);
            stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery(query);
            while (rs.next())
            {
                System.out.println( "id : " + rs.getString(1) +" "+ "type : " + rs.getString(2));
            }
            stmt.close();
            con.close();
        } catch(SQLException ex) {
            System.err.println("SQLException: " + ex.getMessage());
        }
        
        }
        
        public static void main(String args[])
          {
                    TESTSQL Bdd = new TESTSQL();
                
    }
    
}

    

